package com.r.pan.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Getter;

/**
 * 使用邮箱验证时想要执行的操作类型
 */
@Getter
public enum OperateType {
    REGISTER(0, "注册账号"),
    RESET_PASSWORD(2, "找回密码");

    @EnumValue
    @JsonValue
    private final Integer value;
    private final String desc;

    OperateType(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public static OperateType of(Integer value) {
        for (OperateType operateType : OperateType.values()) {
            if (operateType.value.equals(value)) {
                return operateType;
            }
        }
        return null;
    }
}
